package cn.fintecher.pangolin.common.model;

import cn.fintecher.pangolin.common.enums.ManagementType;
import cn.fintecher.pangolin.common.enums.AccountType;
import cn.fintecher.pangolin.common.enums.SupervisorState;
import cn.fintecher.pangolin.common.enums.UserState;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.Set;

/**
 * Created by ChenChang on 2017/12/20.
 */
@Data
public class OperatorModel implements Serializable {

    private String id;

    @ApiModelProperty("用户名")
    private String username;

    @ApiModelProperty("BBS关联的ID")
    private String bbsUserId;

    @ApiModelProperty("所属角色")
    private List<String> role;

    @ApiModelProperty("所属委托方")
    private Set<String> principalSet;

    @ApiModelProperty("最后一次登录时间")
    private Date lastLoginTime;

    @ApiModelProperty("头像")
    private String headPic;

    @ApiModelProperty("姓名")
    private String fullName;

    @ApiModelProperty("所属机构")
    private String organization;

    @ApiModelProperty(notes = "部门名称")
    private String detaptName;

    @ApiModelProperty("分公司名称")
    private String companyName;

    @ApiModelProperty("分公司Id")
    private String companyId;

    @ApiModelProperty(notes = "部门code")
    private String deptCode;

    @ApiModelProperty("创建时间")
    private Date createDateTime;

    @ApiModelProperty("入职时间")
    private Date createTime;

    @ApiModelProperty("催收员类型")
    private AccountType accountType;

    @ApiModelProperty(notes = "是否是管理员 NO-否，YES-是")
    private ManagementType isManager;

    @ApiModelProperty("状态 INCUMBENCY(\"在职\"),  DIMISSION(\"离职\");")
    private UserState state;

    @ApiModelProperty("引导新人")
    private Set<String> guideNewsSet;

    @ApiModelProperty(notes = "监督人状态 ENABLED:是  DISABLED:否")
    private SupervisorState supervisorState;

    @ApiModelProperty("机构所属城市")
    private String entrustCaseCity;

    @ApiModelProperty("所属城市")
    private String belongsCity;

    private Set<ResourceModel> menu;

    private Set<String> resource ;

    private List<PrincipalSearchModel> principalSearchModels;

    @ApiModelProperty("外线号码")
    private List<CallPhone> callPhones;

    @ApiModelProperty("坐席号码")
    private String seatNumber;

    @ApiModelProperty("坐席密码")
    private String callPsw;

    @ApiModelProperty("坐席分机")
    private String exten;

    /**
     *
     * 功能描述:
     * 获取默认的坐席号
     * @param: []
     * @return: java.lang.String
     * @auther: cowboy
     * @date: 2019/2/25 11:28
     */
    public String getDefaultCall(){
        if(Objects.nonNull(callPhones)){
            for (CallPhone obj :callPhones){
                if(obj.getDefaultNo().equals(ManagementType.YES)){
                    return obj.getPhoneNo();
                }
            }
        }
        return "";
    }
}
